import request from '@/plugins/request'
import url from '@/plugins/url'
// let ip = 'http://192.168.96.166:5757';
let ip = 'http://localhost:5757';

/**
 * 管理员登录
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function login(data) {
  return request({
    url: ip+'/api/admin/login',
    method: 'POST',
    data: data
  })
}


/**
 * 获取所有用户数据
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function get_user_total(data) {
  return request({
    url: ip+'/api/admin/admin_count',
    method: 'POST',
    data: data
  })
}

/**
 * 获取用户
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function get_user_all(data) {
  return request({
    url: ip+'/api/admin/admin_all',
    method: 'POST',
    data: data
  })
}

/**
 * 获取单个用户
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function get_user_one(data) {
  return request({
    url: ip+'/api/admin/admin_one',
    method: 'POST',
    data: data
  })
}

/**
 * 添加用户
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function add_user(data) {
  return request({
    url: ip+'/api/admin/admin_add',
    method: 'POST',
    data: data
  })
}

/**
 * 修改用户
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function edit_user(data) {
  return request({
    url: ip+'/api/admin/admin_edit',
    method: 'POST',
    data: data
  })
}

/**
 * 删除用户
 * @param  {[type]} data [description]
 * @return {[type]}      [description]
 */
export function del_user(data) {
  return request({
    url: ip+'/api/admin/admin_del',
    method: 'POST',
    data: data
  })
}